package com.jboy.test;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public class ThreadLifecycleDemo {
    private static final Map<String, Function<String, String>> map = new HashMap<>();


    static {
        System.out.println("静态代码块");
        map.put("a", (s) -> s + "a");

    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            System.out.println("线程执行中...");
        });

        System.out.println("启动前状态: " + thread.getState()); // NEW
        thread.start();
        System.out.println("启动后状态: " + thread.getState()); // RUNNABLE
        Thread.sleep(100);
        System.out.println("执行后状态: " + thread.getState()); // TERMINATED
    }
}
